<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>设置值班人</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctxStatic}/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/plugins/h+/css/plugins/webuploader/webuploader.css">
    <link href="${ctxStatic}/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/layer/laydate/laydate.js"></script>
    <style>
        .demo-input{padding-left: 10px; height: 38px; min-width: 262px; line-height: 38px; border: 1px solid #e6e6e6;  background-color: #fff;  border-radius: 2px;}
        .demo-footer{padding: 50px 0; color: #999; font-size: 14px;}
        .demo-footer a{padding: 0 5px; color: #01AAED;}
        .fl{
            float: left;
        }
        .clearfix{
            *zoom:1;
        }
        .clearfix:after{
            content: "";
            clear: both;
            height:0;
            line-height:0;
            display:block;
            visibility:hidden;
        }
        .padL15{
            padding-left: 15px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">

                <div class="ibox-content">
                    <form onsubmit="return  false" class="form-horizontal m-t" id="bizpersonForm">
                        <input id="dutyUserId" value="" name="dutyUserId" type="hidden">

                        <div class="row">
                            <div class="col-sm-12 col-md-12 form-group clearfix">
                                <label class="col-sm-4 col-md-3 control-label fl">值班人：</label>
                                <div class="col-sm-6 col-md-6 fl">
                                    <input style="width:200px" name="personName" id="personName"  readonly="true" class="form-control" type="text">
                                </div>
                                <div class="col-sm-2 col-md-3 fl">
                                    <input type="button" class="btn btn-primary" onclick="showSysUserList()" value="选择" >
                                    </div>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <label class="col-sm-4 control-label fl">账号：</label>
                            <div class="col-sm-8 fl">
                                <label class="padL15" id="lbl_loginName"><font style="color:red">请先选择值班人</font></label>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <label class="col-sm-4 control-label fl">时间段：</label>
                            <div class="col-sm-8 fl">
                                <input placeholder="时间段" style="width:200px" id="dutyDate" name="dutyDate"  class="form-control" />
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-sm-8 text-center col-sm-offset-3">
                                <input type="submit" class="btn btn-primary" value="提交" >
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="${ctxStatic}/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctxStatic}/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/bootstrap-table.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/locale/bootstrap-table-zh-CN.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/export/bootstrap-table-export.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/editable/bootstrap-table-editable.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/layer2.4/layer.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/messages_zh.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/demo/form-validate-demo.min.js"></script>

<script>

    var areaData;
    var index = parent.layer.getFrameIndex(window.name);
    laydate.render({
        elem: '#dutyDate'
        ,range: true
    });
    $(function(){

        $("#bizpersonForm").validate({
            submitHandler : function() {
                doSubmit();
            },
            rules:{

            },
            messages:{

            },
            //是否在获取焦点时验证
            onfocusout:true,
            //是否在敲击键盘时验证
            //onkeyup:false,
            //提交表单后，（第一个）未通过验证的表单获得焦点
            focusInvalid:false,
            //当未通过验证的元素获得焦点时，移除错误提示
            focusCleanup:false
        });

        //自定义正则表达示验证方法
        $.validator.addMethod("checkPhone",function(value,element,params){
            var checkPhone = /^1[3,5,7,8]\d{9}$/;
            return this.optional(element)||(checkPhone.test(value));
        },"*请输入正确的手机号码！");

    });


    function doSubmit()
    {
        var dutyUserId=$("#dutyUserId").val();
        var personName=$("#personName").val();
        var dutyDate=$("#dutyDate").val();
        if(dutyUserId==null||dutyUserId==""||personName==null||personName==""){
            alert("请选择值班人");
            return;
        }
        if(dutyDate==null||dutyDate==""){
            alert("请选择时间段");
            return;
        }
        $.ajax( {
            url:'${pageContext.request.contextPath}/sysUser/doSetDutyUser.ac',// 跳转到 action
            data:$("#bizpersonForm").serialize(),
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                if(data.success==true) {
                    alert("操作成功！");

                    parent.layer.close(index);
                }else {
                    alert("操作失败!");
                }
            },
            error : function() {
                alert("操作失败！");
            }
        });
    }

    function showSysUserList()
    {
        parent.layer.open({
            type: 2,
            shift:4,//动画类型
            moveType:1,
            maxmin: true,
            shadeClose: true, //开启遮罩关闭
            area: ['800px', '500px'],
            title:'人员选择',
            content: '${pageContext.request.contextPath}/sysUser/toShowSysUserList.ac?index='+index,
            success: function(layero, index){
                var datas={"firstname":"555555"};
            },
            cancel: function(index){
                return true;
            }
        });
    }

    function setSysUser(sysUserId,loginName,personName) {
        $("#dutyUserId").val(sysUserId);
        $("#lbl_loginName").html(loginName);
        $("#personName").val(personName);
    }
</script>

</body>

</html>

